|
RtGetBusDataByOffset obtains details, starting at the given offset, about a given slot on an I/O bus.
Syntax
ULONG RtGetBusDataByOffset( BUS_DATA_TYPE BusDataType, ULONG BusNumber, ULONG SlotNumber, PVOID pBuffer, ULONG Offset, ULONG Length );
Parameters
BusDataType
Type of bus data to be retrieved. Currently, its value can be PNPISAConfiguration, EisaConfiguration, Pos, or PCIConfiguration. The upper bound on the bus types supported is always MaximumBusDataType.
BusNumber
Zero-based and system-assigned number of the bus in systems with more than one bus of the same BusDataType.
SlotNumber
Logical slot number. When PCIConfiguration is specified, this is a PCI_SLOT_NUMBER_TYPE value.
When PNPISAConfiguration is specified, logical slot numbers start at one (1). If Offset is 0, the value passed for parameter SlotNumber is formed by shifting the logical slot number to the left 8 bits. If Offset is 1, the value passed for parameter SlotNumber is formed by shifting the logical slot number to the left by 8 bits and logically ORing the result with the index into the LogicalDeviceInfo[] member of ISA_PNP_CONFIG corresponding to the logical device of interest. Logical slot numbers are assigned only to those devices that are under the control of RTX.
pBuffer
A pointer to a caller-supplied buffer for configuration information specific to BusDataType.
If PNPISAConfiguration is specified, the contents of the buffer will depend on the value passed for Offset: if Offset is 0, the buffer will contain an ISA_PNP_CONFIG structure for the logical slot number specified in SlotNumber; if Offset is 1, the buffer will contain an ISA_PNP_RESOURCES structure for the logical slot number and logical device specified in SlotNumber.
For BusDataType PNPISAConfiguration on Windows, memory addresses are always returned in ISA_PNP_RESOURCES as Memory32Descriptors[], never as Memory24Descriptors[]. The Flags member of structure ISA_PNP_RESOURCES is not used and is always set to ISA_PNP_RESOURCE_FLAG_ACTIVE upon return.
If EisaConfiguration is specified, the buffer will contain the CM_EISA_SLOT_INFORMATION structure followed by zero or more CM_EISA_FUNCTION_INFORMATION structures for the specified slot.
If Pos is specified, the buffer will contain a CM_MCA_POS_DATA structure for the specified slot.
When PCIConfiguration is specified, the buffer will contain some or all of the PCI_COMMON_CONFIG information for the given SlotNumber. The specified Offset and Length determine how
Offset
If the BusDataType is EisaConfiguration or Pos, the offset is zero. If the BusDataType is PNPISAConfiguration, Offset can be either 0 or 1. A value of 0 indicates a request for ISA_PNP_CONFIG data. A value of 1 indicates a request for ISA_PNP_RESOURCES data. Otherwise, it specifies the byte offset in the PCI_COMMON_CONFIG structure for which the requested information should be returned. Callers can use the system-defined constant, PCI_COMMON_HDR_LENGTH, to specify the device-specific area of PCI_COMMON_CONFIG.
Length
Maximum number of bytes to return in the buffer. Ignored for PNPISAConfiguration; based on the value of Offset either an ISA_PNP_CONFIG or an ISA_PNP_RESOURCES structure is returned in pBuffer.
Return Values
The number of bytes of data if the write to the given buffer (pBuffer) succeeded, zero if the given BusDataType is not valid for the current platform
When the input BusDataType is PCIConfiguration, RtGetBusDataByOffset can return either of the following values to indicate an error:
Value |
Meaning |
0 (zero) |
The specified PCIBus does not exist. |
2 |
The specified PCIBus exists, but there is no device at the given PCI SlotNumber. The buffer also contains the value PCI_INVALID_VENDOR_ID at the PCI_COMMON_CONFIG VENDORID member. |
When the input BusDataType is PNPISAConfiguration, RtGetBusDataByOffset can return any of the following values:
Value |
Meaning |
0 (zero) |
The specified BusDataType is not valid for the current platform. For PNPISAConfiguration, this usually means that the platform is running Windows. |
1 |
An unsupported BusNumber value was specified. |
2 |
There is no device at the specified SlotNumber. |
3 |
An error has occurred. |
Remarks
This call can be used to locate devices on a particular I/O bus in the machine. The bus-type-specific configuration data returned can later be used in other calls, such as RtSetBusDataByOffset and RtTranslateBusAddress.
When accessing the device-specific area of the PCI configuration space, RtGetBusDataByOffset guarantees the following:
The PCI and PNP ISA structures and values above are defined in rtapi.h. For more information, consult the Windows Driver Development Kit.
Requirements
Header | Rtapi.h |
Library | rtapi_w32.lib (Windows), Rtx_Rtss.lib (RTSS) |
See Also:
HalGetBusDataByOffset (in the Windows Driver Development Kit)